package com.oigx.lookmu;

import com.intellij.openapi.project.Project;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowFactory;
import com.intellij.ui.content.Content;
import com.intellij.ui.content.ContentFactory;
import com.oigx.lookmu.ui.LookDialog;
import org.jetbrains.annotations.NotNull;



public class LookMuFactory implements ToolWindowFactory {

    private static LookDialog lookDialog ;



    @Override
    public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
        initLookDialog(project);
        Content content = ContentFactory.SERVICE.getInstance().createContent(lookDialog.getRootComponent(), "书架", false);
        toolWindow.getContentManager().addContent(content);
    }


    /**
     * 保证ChapterWindowUI单例
     */
    public static LookDialog initLookDialog(Project project) {
        if (lookDialog == null) {
            lookDialog = new LookDialog(project);
        }
        return lookDialog;
    }


}
